import { WebDBMgr } from "./WebDBMgr"


export class Sqlite3Mgr {

    static getData(dbName: string, sqlStr: string, ...data: any): Promise<any> {
        if (globalThis.Sqlite3Manager) {
            return globalThis.Sqlite3Manager.getData(dbName, sqlStr, ...data)
        } else {
            return WebDBMgr.getData(dbName, sqlStr, ...data)
        }
    }
    static allData(dbName: string, sqlStr: string, ...data: any): Promise<any> {
        if (globalThis.Sqlite3Manager) {
            return globalThis.Sqlite3Manager.allData(dbName, sqlStr, ...data)
        } else {
            return WebDBMgr.allData(dbName, sqlStr, ...data)
        }
    }
    static setData(dbName: string, sqlStr: string, ...data: any): Promise<any> {
        if (globalThis.Sqlite3Manager) {
            return globalThis.Sqlite3Manager.setData(dbName, sqlStr, ...data)
        } else {
            return WebDBMgr.setData(dbName, sqlStr, ...data)
        }
    }

    static execData(dbName: string, sqlStr: string): Promise<any> {
        if (globalThis.Sqlite3Manager) {
            return globalThis.Sqlite3Manager.execData(dbName, sqlStr)
        } else {
            return WebDBMgr.execData(dbName, sqlStr)
        }
    }

    static transactionData(dbName: string, sqlStr: string, list: any[]) {
        if (globalThis.Sqlite3Manager) {
            return globalThis.Sqlite3Manager.transactionData(dbName, sqlStr, list)
        } else {
            return WebDBMgr.transactionData(dbName, sqlStr, list)
        }
    }
}